<template>
  <div class="apply-dialog">
    <div v-if="thisDiv === 1 || thisDiv === 2">
      <div class="title" style="display: flex;">
        <div style="flex: 1; text-align: left;padding-left: 30px;font-size: 25px;">
          {{ models.eventName }}
        </div>
        <div class="btn-list flex flex-row align-center">
          <el-button type="warning" size="mini" :loading="saveLoading" @click="saveAction">暂存</el-button>
          <el-button type="primary" size="mini" :loading="submitLoading" @click="submitAction">上报</el-button>
          <el-button type="info" size="mini" @click="handleClose">返回</el-button>
        </div>
      </div>
      <el-form
        ref="generateForm"
        label-suffix=":"
        size="small"
        :model="models"
        :rules="rules"
        label-position="right"
        label-width="130px"
      >
        <div >
          <title-info title="上报⼈信息" >
            <reporter-info slot="left" :form-data="models" :this-div="thisDiv"/>
          </title-info>
        </div>
        <div >
          <title-info title="当事人信息" >
            <party-info slot="left" :form-data="models" :this-div="thisDiv"/>
          </title-info>
        </div>
        <div >
          <title-info title="当事患者信息" >
            <patient-info slot="left" :form-data="models" :this-div="thisDiv"/>
          </title-info>
        </div>
        <div >
          <title-info title="事件信息" >
            <event-info slot="left" :form-data="models" :this-div="thisDiv"/>
          </title-info>
        </div>
        <div >
          <title-info title="输液信息" >
            <div slot="left" style="display: flex; width: 100%; flex-wrap: wrap; ">
              <div style="display: flex; flex-wrap: wrap; width: 85%">
                <el-form-item label="⽤药⽇期" prop="baqsjRecordDiagnosisInfusionReaction.drugDate" style="flex: 1; min-width: 200px;">
                  <el-date-picker
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugDate"
                    type="date"
                    :style="{ width: '100%' }"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="⽤药开始时间" prop="baqsjRecordDiagnosisInfusionReaction.drugStartTime" style="flex: 1; min-width: 200px;">
                  <el-date-picker
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugStartTime"
                    type="date"
                    :style="{ width: '100%' }"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="⽤药结束时间" prop="baqsjRecordDiagnosisInfusionReaction.drugEndTime" style="flex: 1; min-width: 200px;">
                  <el-date-picker
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugEndTime"
                    type="date"
                    :style="{ width: '100%' }"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="药物数量" prop="baqsjRecordDiagnosisInfusionReaction.drugNumber" style="flex: 1; min-width: 200px;">
                  <el-input-number
                    :style="{ width: '100%' }"
                    placeholder="请输入药物数量"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugNumber"
                  />
                </el-form-item>
                <div style="width: 100%;"/>
                <el-form-item label="药品名称1" prop="baqsjRecordDiagnosisInfusionReaction.drugName1" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入药品名称"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName1"
                  />
                </el-form-item>
                <el-form-item label="批号" prop="baqsjRecordDiagnosisInfusionReaction.drugName1BatchNo" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入批号"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName1BatchNo"
                  />
                </el-form-item>
                <el-form-item label="剂量" prop="baqsjRecordDiagnosisInfusionReaction.drugName1Dosage" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入剂量"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName1Dosage"
                  />
                </el-form-item>
                <el-form-item label="⽣产⼚家" prop="baqsjRecordDiagnosisInfusionReaction.drugName1Company" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入⽣产⼚家"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName1Company"
                  />
                </el-form-item>
                <div style="width: 100%;"/>
                <el-form-item label="药品名称2" prop="baqsjRecordDiagnosisInfusionReaction.drugName2" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入药品名称"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName2"
                  />
                </el-form-item>
                <el-form-item label="批号" prop="baqsjRecordDiagnosisInfusionReaction.drugName2BatchNo" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入批号"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName2BatchNo"
                  />
                </el-form-item>
                <el-form-item label="剂量" prop="baqsjRecordDiagnosisInfusionReaction.drugName2Dosage" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入剂量"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName2Dosage"
                  />
                </el-form-item>
                <el-form-item label="⽣产⼚家" prop="baqsjRecordDiagnosisInfusionReaction.drugName2Company" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入⽣产⼚家"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName2Company"
                  />
                </el-form-item>
                <div style="width: 100%;"/>
                <el-form-item label="药品名称3" prop="baqsjRecordDiagnosisInfusionReaction.drugName3" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入药品名称"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName3"
                  />
                </el-form-item>
                <el-form-item label="批号" prop="baqsjRecordDiagnosisInfusionReaction.drugName3BatchNo" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入批号"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName3BatchNo"
                  />
                </el-form-item>
                <el-form-item label="剂量" prop="baqsjRecordDiagnosisInfusionReaction." style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入剂量"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName3Dosage"
                  />
                </el-form-item>
                <el-form-item label="⽣产⼚家" prop="baqsjRecordDiagnosisInfusionReaction.drugName3Company" style="flex: 1; min-width: 200px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入⽣产⼚家"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.drugName3Company"
                  />
                </el-form-item>
                <div style="width: 100%;"/>
                <el-form-item label="输液器" prop="baqsjRecordDiagnosisInfusionReaction.apparatusInfusionis" style="flex: 1; min-width: 100px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入输液器"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.apparatusInfusionis"
                  />
                </el-form-item>
                <el-form-item label="批号" prop="baqsjRecordDiagnosisInfusionReaction.apparatusInfusionisBatchNo" style="flex: 1; min-width: 100px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入批号"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.apparatusInfusionisBatchNo"
                  />
                </el-form-item>
                <el-form-item label="⽣产⼚家" prop="baqsjRecordDiagnosisInfusionReaction.apparatusInfusionisCompany" style="flex: 1; min-width: 100px;">
                  <el-input
                    :style="{ width: '100%' }"
                    placeholder="请输入⽣产⼚家"
                    v-model="models.baqsjRecordDiagnosisInfusionReaction.apparatusInfusionisCompany"
                  />
                </el-form-item>
                <div style="flex: 1; min-width: 100px;" />
              </div>
              <div style="width: 100%" />
              <el-form-item label="输液反应" prop="infusionActionArr" label-width="150px">
                <div style="display: inline-block; width: 100%">
                  <el-checkbox-group v-model="models.infusionActionArr" style="display: inline-block">
                    <el-checkbox
                      v-for="(item, index) in infusionActionList"
                      :key="index"
                      :label="item.value"
                    >
                      <div style="display: flex;align-items: center;">
                        <div style="display: flex;align-items: center;">
                          {{ item.label }}
                        </div>
                        <!--        二维数据              -->
                        <div v-if="models.infusionActionArr && models.infusionActionArr.indexOf('1') > -1 && item.value === '1'" style="margin-left: 5px;display: flex;align-items: center;">
                          (
                          <el-checkbox-group v-model="models.infusionActionHaveArr">
                            <el-checkbox v-for="(item, index) in infusionActionHaveList" :key="index" :label="item.value"> {{ item.label }} </el-checkbox>
                          </el-checkbox-group>
                          )
                        </div>
                      </div>
                    </el-checkbox>
                    <el-input
                      v-if="models.infusionActionArr && models.infusionActionArr.indexOf('3') > -1"
                      :style="{ width: '200px', 'margin-left': '5px', display: 'inline-block' }"
                      placeholder="请输入"
                      v-model="models.baqsjRecordDiagnosisInfusionReaction.infusionActionOther"
                    />
                  </el-checkbox-group>
                </div>
              </el-form-item>
            </div>
          </title-info>
        </div>
        <div >
          <title-info title="处理措施" >
            <measure-two-info slot="left" :form-data="models" :this-div="thisDiv">
              <el-form-item slot="right" label="医疗介入" prop="medicalInvolvedArr">
                <div style="display: flex;">
                  <el-checkbox-group v-model="models.medicalInvolvedArr">
                    <el-checkbox v-for="(item, index) in medicalInterventionList" :key="index" :label="item.value"> {{ item.label }} </el-checkbox>
                    <el-input
                      v-if="models.medicalInvolvedArr && models.medicalInvolvedArr.indexOf('125') > -1"
                      :style="{ width: '200px', 'margin-left': '5px' }"
                      placeholder="请输入"
                      v-model="models.baqsjRecordHandle.medicalInvolvedOther"
                    />
                  </el-checkbox-group>
                </div>
              </el-form-item>
              <div slot="right" style="width: 100%" />
              <el-form-item slot="right"  label="其他介入" prop="otherInvolvedArr">
                <div style="display: flex;">
                  <el-checkbox-group v-model="models.otherInvolvedArr">
                    <el-checkbox v-for="(item, index) in otherInterventionList" :key="index" :label="item.value"> {{ item.label }} </el-checkbox>
                    <el-input
                      v-if="models.otherInvolvedArr && models.otherInvolvedArr.indexOf('134')  > -1"
                      :style="{ width: '200px', 'margin-left': '5px' }"
                      placeholder="请输入"
                      v-model="models.baqsjRecordHandle.otherInvolvedOther"
                    />
                  </el-checkbox-group>
                </div>
              </el-form-item>
            </measure-two-info>
          </title-info>
        </div>
        <div >
          <title-info title="其他信息说明" >
            <other-info slot="left" :form-data="models" :this-div="thisDiv"/>
          </title-info>
        </div>
      </el-form>
    </div>
    <div v-if="thisDiv === 3">>
      <div>
        <title-info title="上报⼈信息">
          <reporter-info slot="left" :form-data="models" :this-div="thisDiv" />
        </title-info>
      </div>
      <div>
        <title-info title="当事人信息">
          <party-info slot="left" :form-data="models" :this-div="thisDiv"/>
        </title-info>
      </div>
      <div>
        <title-info title="当事患者信息">
          <patient-info slot="left" :form-data="models" :this-div="thisDiv"/>
        </title-info>
      </div>
      <div>
        <title-info title="事件信息">
          <event-info slot="left" :form-data="models" :this-div="thisDiv"/>
        </title-info>
      </div>
      <div>
        <title-info title="输液信息">
          <div slot="left">
            <table>
              <tr>
                <td class="td-title">⽤药⽇期</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugDate || '' }}</td>
                <td class="td-title">⽤药开始时间</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugStartTime || '' }}</td>
                <td class="td-title">⽤药结束时间</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugEndTime || '' }}</td>
                <td class="td-title">药物数量</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugNumber || '' }}</td>
              </tr>
              <tr>
                <td class="td-title">药品名称1</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName1 || '' }}</td>
                <td class="td-title">批号</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName1BatchNo || '' }}</td>
                <td class="td-title">剂量</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName1Dosage || '' }}</td>
                <td class="td-title">⽣产⼚家</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName1Company || '' }}</td>
              </tr>
              <tr>
                <td class="td-title">药品名称2</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName2 || '' }}</td>
                <td class="td-title">批号</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName2BatchNo || '' }}</td>
                <td class="td-title">剂量</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName2Dosage || '' }}</td>
                <td class="td-title">⽣产⼚家</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName2Company || '' }}</td>
              </tr>
              <tr>
                <td class="td-title">药品名称3</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName3 || '' }}</td>
                <td class="td-title">批号</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName3BatchNo || '' }}</td>
                <td class="td-title">剂量</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName3Dosage || '' }}</td>
                <td class="td-title">⽣产⼚家</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.drugName3Company || '' }}</td>
              </tr>
              <tr>
                <td class="td-title">输液器</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.apparatusInfusionis || '' }}</td>
                <td class="td-title">批号</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.apparatusInfusionisBatchNo || '' }}</td>
                <td class="td-title">⽣产⼚家</td>
                <td>{{ models.baqsjRecordDiagnosisInfusionReaction.apparatusInfusionisCompany || '' }}</td>
                <td class="td-title">输液反应</td>
                <td>{{ getInfusionActionTypes(models.infusionActionArr) || '' }}</td>
              </tr>
            </table>
          </div>
          </title-info>
        </div>
        <div>
          <title-info title="处理措施">
            <measure-two-info slot="left" :form-data="models" :this-div="thisDiv">
              <tr slot="right">
                <td class="td-title">医疗介入</td>
                <td>{{ formatMedicalInterventions(models.medicalInvolvedArr) || '' }}</td>
              </tr>
              <tr slot="right">
                <td class="td-title">其他介入</td>
                <td>{{ formatOtherInterventions(models.otherInvolvedArr) || '' }}</td>
              </tr>
            </measure-two-info>
          </title-info>
        </div>
        <div>
          <title-info title="其他信息说明">
            <other-info slot="left" :form-data="models" :this-div="thisDiv"/>
          </title-info>
        </div>
    </div>
  </div>
</template>

<script>
import { doSaveDiagnosisInfusionReaction } from '@/api/report/reportForm'

import titleInfo from '@/views/newBaqsj/apply/components/reportForm/dialog/titleInfo.vue'
import reporterInfo from '@/views/newBaqsj/apply/components/reportForm/dialog/reporterInfo.vue'
import partyInfo from '@/views/newBaqsj/apply/components/reportForm/dialog/partyInfo.vue'
import patientInfo from '@/views/newBaqsj/apply/components/reportForm/dialog/patientInfo.vue'
import eventInfo from '@/views/newBaqsj/apply/components/reportForm/dialog/eventInfo.vue'
import measureTwoInfo from '@/views/newBaqsj/apply/components/reportForm/dialog/measureTwoInfo.vue'
import otherInfo from '@/views/newBaqsj/apply/components/reportForm/dialog/otherInfo.vue'

export default {
  name: 'DiagnosisInfusionReaction',
  components: { titleInfo, reporterInfo, partyInfo, patientInfo, eventInfo, measureTwoInfo, otherInfo },
  data() {
    return {
      // 当前显示的div：1 dialog 2 详情 3 处置
      thisDiv: 0,
      models: {
        baqsjRecordDiagnosisInfusionReaction: {
          drugDate: null,
          drugStartTime: null,
          drugEndTime: null
        }
      },
      loading: false,
      dialogVisible: false,
      dialogDetailVisible: false,
      submitLoading: false,
      saveLoading: false,
      rules: {},
      infusionActionList: [
        { value: '1', label: '有' },
        { value: '2', label: '无' },
        { value: '3', label: '其他' }
      ],
      infusionActionHaveList: [
        { value: '121', label: '⽪肤瘙痒/⽪丘疹' },
        { value: '122', label: '发冷/寒颤/发热' },
        { value: '123', label: '恶⼼/呕吐' },
        { value: '124', label: '头晕/头痛' },
        { value: '125', label: '呼吸困难' }
      ],
      medicalInterventionList: [
        { value: '120', label: '持续观察' },
        { value: '121', label: '加强护理防范' },
        { value: '122', label: '监测生命体征' },
        { value: '123', label: '伤口护理' },
        { value: '124', label: '给予额外关注（如约束、注射治疗、药物治疗）' },
        { value: '125', label: '其他' }
      ],
      otherInterventionList: [
        { value: '130', label: '予以病人家属慰问和支持' },
        { value: '132', label: '通报卫生主管机构' },
        { value: '134', label: '其他' }
      ]
    }
  },
  methods: {
    handleClose(val) {
      this.dialogVisible = false
      // 传到父组件
      this.$emit('close', val)
    },
    handleDetailClose() {
      this.dialogDetailVisible = false
    },
    getDetail(info) {
      this.models = {
        ...info,
        medicalInvolvedArr: (info.baqsjRecordHandle && info.baqsjRecordHandle.medicalInvolved) ? info.baqsjRecordHandle.medicalInvolved.split(',') : [],
        otherInvolvedArr: (info.baqsjRecordHandle && info.baqsjRecordHandle.otherInvolved) ? info.baqsjRecordHandle.otherInvolved.split(',') : [],
        infusionActionArr: (info.baqsjRecordDiagnosisInfusionReaction && info.baqsjRecordDiagnosisInfusionReaction.infusionAction) ? info.baqsjRecordDiagnosisInfusionReaction.infusionAction.split(',') : [],
        infusionActionHaveArr: (info.baqsjRecordDiagnosisInfusionReaction && info.baqsjRecordDiagnosisInfusionReaction.infusionActionHave) ? info.baqsjRecordDiagnosisInfusionReaction.infusionActionHave.split(',') : []
      };
      console.log(this.models);
    },
    editInfo(ruleInfo, info) {
      this.thisDiv = 2
      this.dialogVisible = true
      this.rules = ruleInfo
      this.getDetail(info)
    },
    detail(info) {
      this.thisDiv = 3
      this.dialogDetailVisible = true
      this.getDetail(info)
    },
    open(ruleInfo, modelInfo) {
      // 弹出框
      this.thisDiv = 1
      this.rules = {
        ...ruleInfo,
        'baqsjRecordDiagnosisInfusionReaction.drugDate': [{ required: true, message: '请选择⽤药⽇期', trigger: 'blur' }],
        'baqsjRecordDiagnosisInfusionReaction.drugStartTime': [{ required: true, message: '请选择⽤药开始时间', trigger: 'blur' }],
        'baqsjRecordDiagnosisInfusionReaction.drugEndTime': [{ required: true, message: '请选择⽤药结束时间', trigger: 'blur' }],
        'baqsjRecordDiagnosisInfusionReaction.drugNumber': [{ required: true, message: '请输入药物数量', trigger: 'blur' }],
        'baqsjRecordDiagnosisInfusionReaction.drugName1': [{ required: true, message: '请输入药品名称', trigger: 'blur' }],
        'baqsjRecordDiagnosisInfusionReaction.drugName1Dosage': [{ required: true, message: '请输入剂量', trigger: 'blur' }],
        'baqsjRecordDiagnosisInfusionReaction.apparatusInfusionis': [{ required: true, message: '请输入输液器', trigger: 'blur' }],
        'infusionActionArr': [{ required: true, message: '请选择输液反应', trigger: 'change' }]
      }
      this.models = {
        ...modelInfo,
        eventNo: 'DiagnosisInfusionReaction',
        eventName: '诊疗相关-输液反应事件',
        // 其他复选框
        // 处理措施=>医疗介入：120-持续观察，121-加强护理防范，122-监测生命体征，123-伤口护理，124-给予额外关注(如：约束、注射治疗、药物治疗)，125-其他
        medicalInvolvedArr: [],
        //  处理措施=>其他介入
        otherInvolvedArr: [],
        // 事件差错详情 => 对象类型 输液反应信息(不同的表单，定制不同)
        baqsjRecordDiagnosisInfusionReaction: {
          drugDate: null,
          drugStartTime: null,
          drugEndTime: null
        },
        // 事件差错详情 => 输液反应 (不同的表单，定制不同)
        infusionActionArr: [],
        // 事件差错详情 => 输液反应详情
        infusionActionHaveArr: []
      }
      this.dialogVisible = true
    },
    submitAction() {
      // 上报
      this.models.auditStatus = 2
      this.actionRequest()
    },
    saveAction(item) {
      // 草稿
      this.models.auditStatus = 1
      this.actionRequest()
    },
    actionRequest() {
      // 新增、编辑、暂存
      this.$refs['generateForm'].validate(valid => {
        if (valid) {
          this.$message({
            message: '正在操作请稍等...',
            type: 'warning'
          })
          this.saveLoading = true
          this.submitLoading = true

          this.models.baqsjRecordHandle.medicalInvolved = this.models.medicalInvolvedArr.join(',')
          this.models.baqsjRecordHandle.otherInvolved = this.models.otherInvolvedArr.join(',')
          this.models.baqsjRecordDiagnosisInfusionReaction.infusionAction = this.models.infusionActionArr.join(',')
          this.models.baqsjRecordDiagnosisInfusionReaction.infusionActionHave = this.models.infusionActionHaveArr.join(',')
          doSaveDiagnosisInfusionReaction(this.models).then(res => {
            if (res.resStatus !== 500) {
              this.$message({
                type: 'success',
                message: '操作成功!'
              })
              this.saveLoading = false
              this.submitLoading = false
              // 关闭弹出框
              this.dialogVisible = false
              this.handleClose(1)
            } else {
              this.$message({
                type: 'error',
                message: '操作失败!'
              })
              this.saveLoading = false
              this.submitLoading = false
            }
          })
        } else {
          this.$message({
            message: '请填写必填项',
            type: 'warning'
          })
        }
      })
    },
    // getInfusionActionTypes 方法
    getInfusionActionTypes(values) {
      if (!values || values.length === 0) return '';
      const labels = [];
      this.infusionActionList.forEach(item => {
        if (values.includes(item.value)) {
          if (item.value === '1') {
            const haveLabels = [];
            this.infusionActionHaveList.forEach(haveItem => {
              if (this.models.infusionActionHaveArr && this.models.infusionActionHaveArr.includes(haveItem.value)) {
                haveLabels.push(haveItem.label);
              }
            });
            labels.push(`${item.label}（${haveLabels.join(', ')}）`);
          } else if (item.value === '3') {
            labels.push(`其他（${this.models.baqsjRecordDiagnosisInfusionReaction.infusionActionOther || ''}）`);
          } else {
            labels.push(item.label);
          }
        }
      });
      return labels.join(', ');
    },
    formatMedicalInterventions(values) {
      if (!values || values.length === 0) return ''
      const labels = []
      // 按照字典顺序遍历
      this.medicalInterventionList.forEach(item => {
        if (values.includes(item.value)) {
          if (item.value === '125') {
            labels.push(`其他（${this.models.baqsjRecordHandle.medicalInvolvedOther || ''}）`)
          } else {
            labels.push(item.label)
          }
        }
      })
      return labels.join(', ')
    },
    formatOtherInterventions(values) {
      if (!values || values.length === 0) return ''
      const labels = []
      // 按照字典顺序遍历
      this.otherInterventionList.forEach(item => {
        if (values.includes(item.value)) {
          if (item.value === '134') {
            labels.push(`其他（${this.models.baqsjRecordHandle.otherInvolvedOther || ''}）`)
          } else {
            labels.push(item.label)
          }
        }
      })
      return labels.join(', ')
    }
  }
}
</script>

<style lang="scss" scoped>
.title {
  padding: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, .1);
  position: sticky;
  top: 0;
  z-index: 2000;
  background-color: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  table-layout: fixed;
}
td {
  border: 1px solid #ccc;
  padding: 10px;
  text-align: left;
  /* 调整行间距 */
  line-height: 1.6;
  /* 调整字体大小 */
  font-size: 18px;
  /* 调整字间距 */
  letter-spacing: 0.5px;
}

.td-title {
  width: 12%;
  background-color: #fff;
}
</style>
